<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<title>{if $seo_title}{$seo_title}{else}{if $head_title}{$head_title}{$DT[seo_delimiter]}{/if}{if $city_sitename}{$city_sitename}{else}{$DT[sitename]}{/if}{/if}</title>
	<!--{if $head_keywords}-->
	<meta name="keywords" content="{$head_keywords}"/>
	<!--{/if}-->
	<!--{if $head_description}-->
	<meta name="description" content="{$head_description}"/>
	<!--{/if}-->
	<link rel="shortcut icon" type="image/x-icon" href="{SITE_URL}favicon.ico">
	<link rel="bookmark" type="image/x-icon" href="{SITE_URL}favicon.ico">
	<!--{if $head_canonical}-->
	<link rel="canonical" href="{$head_canonical}"/>
	<!--{/if}-->
	<link rel="stylesheet" href="{CSS_URL}lottery.css" media="screen" />
    <base target="_self">
    <script src="{JS_URL}global.js"></script>
    <script src="{JS_URL}libs/seajs/2.2.0/seajs.js"></script>
    <script src="{JS_URL}libs/config.js"></script>
</head>
<body>
	<div class="wrap">
        <a class="go-index" href="{SITE_URL}" title="讯都车网">讯都车网</a>
    	<div class="lottery">
            <ul id="award" class="fn-clear">
                <li class="m5" data-val = "5"><i class=""></i></li>
                <li class="m10" data-val = "10"><i></i></li>
                <li class="m20" data-val = "20"><i></i></li>
                <li class="m0" data-val = "0"><i></i></li>
            </ul>
            <div class="execution">
                <button id="start" class="lottery-btn{if !$_userid} invalid{/if}"></button>
	            {if $_userid}
                <p id="awardTimes">您今天有<span class="red">0次</span>抽奖机会</p>
                {else}
                <p id="logout">您还没有登录</p>
                <div class="log">
                    <a id="J_LogBtn" class="log-btn" href="javascript:void(0);">登录</a>
                    <a class="log-btn" href="/member/register.php?forward={SITE_URL}ernie/">注册</a>
                </div>
                {/if}
            </div>
        </div>
        <div class="lottery-list fn-clear">
            <ul>
            {loop $ernielog $key $log}
                <li class="fn-clear"><span class="fn-left">{$log['username']}获得{$log['prizename']}奖</span><span class="fn-right">{date('m-d',$log['time'])}</span></li>
            {/loop}
            </ul>
        </div>
        <i class="strip"></i>
        <!--导航-->
        <ul class="nav">
            <li><a href="{url('member/charge','action=pay&status=3')}" title="余额查询" target="_blank">余额查询</a></li>
            <li><a href="{url('owncard/index')}" title="金卡购买" target="_blank">金卡购买</a></li>
            <li><a href="{url('member/grade')}" title="会员升级" target="_blank">会员升级</a></li>
            <li class="disabled"><a href="" title="广告位购买" onclick="return false;">广告位购买</a></li>
            <li class="disabled"><a href="" title="功能尚未开通，尽请期待！" onclick="return false;">直销商城</a></li>
        </ul>
        <!--奖励规则 start-->
        <div class="rules">
            <div class="fn-clear">
                <div class="prize-rules fn-left">
                    <h2>奖励规则</h2>
                    <ol>
                        <li>用户必须注册登陆后即可参加每天幸运摇一摇现金活动；</li>
                        <li>苹果数码大奖活动案当月每天登录讯都车网所有用户总数参与抽奖；</li>
                        <li>奔驰Smart大奖活动按2014年12月底前每天登录讯都车网所有用户总数参与抽奖；</li>
                        <li>当期抽奖不可兼得；获奖用户需自行申报纳税；</li>
                        <li>摇一摇现金直接划入用户讯都账户；</li>
                        <li>本奖励活动规则解释权归讯都车网。</li>
                    </ol>
                </div>
                <div class="prize-intro fn-right">
                    <h2>现金奖说明</h2>
                    <ol>
                        <li>现金奖是讯都车网为答谢广大上线用户长期以来的支持而推出的一项回馈活动；</li>
                        <li>现金奖不得提现，只限于讯都车网平台内消费；</li>
                        <li>现金奖可兑换车主金卡、升级会员、购买黄金广告位、购买商品等；</li>
                        <li>本回馈活动规则解释权归讯都车网。</li>
                    </ol>
                </div>
            </div>
            <div class="gift"></div>
        </div>
        <!--奖励规则 end-->
        <!--抽奖结果-->
        <div id="awardResult" class="awardResult10" style="display:none;">
            <a class="close" href="javascript:void(0)" title="关闭">关闭</a>
        </div>
        <div id="noAward" style="display:none;">
            <a class="close" href="javascript:void(0)" title="关闭">关闭</a>
            <span class="copy-btn"  id="J-CopyLink">复制链接
                <embed name="clipboardswf" id="clipboardswf" onmouseover="setcopy_gettext()" devicefont="false" src="{JS_URL}libs/clipboard/clipboard.swf" menu="false" allowscriptaccess="sameDomain" swliveconnect="true" wmode="transparent" type="application/x-shockwave-flash" height="36" width="134
                " style="position: absolute; top: 0; left: 0; z-index: 99; display: none;">
            </span>
            <input id="J-Link" type="text" size="50" value="每天登录讯都车网，赢奔驰smart大奖！ {SITE_URL}?uid={$encodeUserid}">
            <script type="text/javascript">
                var clipboardswfdata,setcopy_gettext,floatwin;
                if(!window.clipboardData){
                    document.getElementById('clipboardswf').style.display = 'block';
                    setcopy_gettext = function(){
                        clipboardswfdata = document.getElementById('J-Link').value;
                        window.document.clipboardswf.SetVariable('str', clipboardswfdata);
                    }
                    floatwin = function(){
                        alert("已复制到剪切板。");
                    }
                }
            </script>
        </div>
        <!--抽奖结果 end-->
        <!--登录-->
        <div id="J_LogBlk" class="log-box" style="display: none;">
            <a class="close" href="javascript:void(0)" title="关闭">关闭</a>
            <div id="warning" class="log-warning" style="display: none">
                <i class="icon-warning"></i>
                <p></p>
            </div>
            <form id="log-form" action="{SITE_URL}member/user_login.php" method="post">
                <input id="auto" type="hidden" value="1" name="auto">
                <input id="returnInfo" type="hidden" value="message" name="returnInfo">
                <input id="forward" type="hidden" value="{SITE_URL}ernie/" name="forward">
                <table>
                <tr>
                    <th>用户名：</th>
                    <td><input id="usr" name="username" class="easyui-validatebox" type="text" size="30" title="请输入用户"></td>
                </tr>
                <tr>
                    <th>密码：</th>
                    <td><input id="psw" name="password" class="easyui-validatebox" type="password" size="30" title="请输入密码"><a href="#" title="找回密码">忘记密码?</a> </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <button id="login" type="submit" class="main-log-btn">登录</button>
                        <a id="register" href="#" class="main-log-btn">注册</a>
                    </td>
                </tr>
            </table>
            </form>
            <i class="log-box-bot"></i>
        </div>
        <!--登录 end-->
    </div>

    <script>
    	seajs.use(['$','lottery'],function($,lottery){
            $("#login").click(function(){
                var usr = $("#usr").val(),
                        psw = $("#psw").val(),
                        auto = $("#auto").val(),
                        forward = $("#forward").val(),
						result;
                $.ajax({
                    url:lemon.site_url+"member/user_login.php",
                    data:{username:usr,password:psw,auto:auto,returnInfo:'json',forward:forward},
                    async:false,
                    dataType:'json',
                    type:'post',
                    success:function(data){
						result = data;
                    }
                });
				if(result.errorNo==1){
					return true;
				}else{
					$("#warning>p").text(result.errorContent);
					$("#warning").show();
                    $("#J_LogBlk>.log-box-bot").css({"bottom":"0"});
					switch(result.errorContent){
						case "请输入登录名称":
						case "用户不存在或被删除":
							$("#usr").focus();
							break;
						case "请输入密码":
						case "密码错误，请重试":
							$("#psw").focus();
							break;
					}
					return false;
				}
                return false;
            });
        })
    </script>
</body>
</html>